#include "qrsagsmapswipeplugin.h"
#include "qgsmaptoolpan.h"

QRSAGSMapSwipePlugin::QRSAGSMapSwipePlugin(QgsMapCanvas *mapCanvas, QgsLayerTreeView * layerTreeVeiw)
{
    this->mMapCanvas = mapCanvas;
    this->mMapSwipeTool = new QRSAGSMapSwipeTool(mapCanvas, layerTreeVeiw);
}

QRSAGSMapSwipePlugin::~QRSAGSMapSwipePlugin()
{
    delete this->mMapCanvas;
    delete this->mMapSwipeTool;
}

void QRSAGSMapSwipePlugin::unload()
{
    this->mMapCanvas->unsetMapTool(this->mMapSwipeTool);
    this->mMapCanvas->refresh();
}

void QRSAGSMapSwipePlugin::run()
{
    if(this->mMapCanvas->mapTool() != this->mMapSwipeTool){
        this->mMapCanvas->setMapTool(this->mMapSwipeTool);
    }
}
